package com.my.design.clone;

import java.util.Date;
import java.util.Objects;

public class Book1 implements Cloneable {

    private String name;//书名
    private Date publishDate;//发布日期

    public Book1() {
    }

    public Book1(String name, Date publishDate) {
        this.name = name;
        this.publishDate = publishDate;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public String getName() {
        return name;
    }

    public Date getPublishDate() {
        return publishDate;
    }

//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (o == null || getClass() != o.getClass()) return false;
//        Book1 book1 = (Book1) o;
//        return Objects.equals(name, book1.name) &&
//                Objects.equals(publishDate, book1.publishDate);
//    }
//
//    @Override
//    public int hashCode() {
//        return Objects.hash(name, publishDate);
//    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    public String toString() {
        return "Book1{" +
                "name='" + name + '\'' +
                ", publishDate=" + publishDate +
                '}';
    }
}
